<template>
  <crumbs></crumbs>
  <div class="wrapper">
    <h5>Arrow</h5>
    <div class="iconsWrapper">
      <el-icon class="icon" v-for="ele in arrowGroup" :key="ele.name">
        <component :is="ele.name" v-copy="`<el-icon><${ele.name} /></el-icon>`"></component>
      </el-icon>
    </div>

    <h5>System</h5>
    <div class="iconsWrapper">
      <el-icon class="icon" v-for="ele in systemGroup" :key="ele.name">
        <component :is="ele.name" v-copy="`<el-icon><${ele.name} /></el-icon>`"></component>
      </el-icon>
    </div>
  </div>
</template>

<script setup lang="ts">
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

let arrowGroupReg: RegExp[] = [/arrow/i, /top/i, /left/i, /right/i, /bottom/i],
  arrowGroup: any = [],
  systemGroup: any = []

Object.entries(ElementPlusIconsVue).reduce((preVal, curVal) => {
  if (arrowGroupReg.some(x => x.test(curVal[0]))) {
    preVal.push(curVal)
  } else {
    systemGroup.push(curVal)
  }
  return preVal
}, arrowGroup)

arrowGroup = Object.fromEntries(arrowGroup)
systemGroup = Object.fromEntries(systemGroup)
</script>

<style lang="less" scoped>
.wrapper {
  padding-bottom: 60px !important;
}
h5 {
  font-size: 18px;
  margin: 0 0 10px 0;
}
.iconsWrapper {
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid #dcdfe6;
  border-left: 1px solid #dcdfe6;
  margin-bottom: 10px;
}
.icon {
  width: 100px;
  height: 100px;
  font-size: 32px;
  border-right: 1px solid #dcdfe6;
  border-bottom: 1px solid #dcdfe6;
  &:hover {
    cursor: pointer;
    background: skyblue;
  }
}
</style>
